package com.example.jrfwcwgl.controller;


import com.example.jrfwcwgl.entity.Factoring;
import com.example.jrfwcwgl.service.IFactoringService;
import com.org.dto.FactoringDTO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 租约保理申请表 前端控制器
 * </p>
 *
 * @author one
 * @since 2021-11-28
 */
@RestController
@RequestMapping("/jrfwcwgl/factoring")
public class FactoringController {

    @Autowired
    private IFactoringService iFactoringService;

    @RequestMapping("/getList")
    public List<Factoring> list(@RequestBody FactoringDTO factoringDTO){
        Factoring factoring = new Factoring();
        BeanUtils.copyProperties(factoringDTO,factoring);
        List<Factoring> list = iFactoringService.getList(factoring);
        for (Factoring factoring1 : list) {
            if ("1".equals(factoring1.getTypeId())){
                factoring1.setTypeName("租房分期");
            }else if ("2".equals(factoring1.getTypeId())){
                factoring1.setTypeName("收房贷");
            }else {
                factoring1.setTypeName("应收租约保理");
            }
            //审核状态
            if(1==factoring1.getApplyState()){
                factoring1.setApplyName("申请中");
            }else if (2==factoring1.getApplyState()){
                factoring1.setApplyName("初审通过");
            }else if (3==factoring1.getApplyState()){
                factoring1.setApplyName("初审不通过");
            }else if (4==factoring1.getApplyState()){
                factoring1.setApplyName("复审通过");
            }else if (5==factoring1.getApplyState()){
                factoring1.setApplyName("复审不通过");
            }

        }
        return list;
    }


}
